import request from '@/config/axios'

export function useMemberApi() {
  return {
    // 查询人员列表
    getMemberPage: async (params: PageParam) => {
      return await request.get({url: '/yxt/member/page', params})
    },
    // 下载学生导入模板
    getTemplate: async (type: number) => {
      return request.download({url: "/yxt/member/get-import-template?type=" + type});
    },
    // 下载专属空间专属人信息导入模板
    getExclusiveTemplate: async (type: number) => {
      return request.download({url: "/yxt/member/get-exclusive-import-template?type=" + type});
    },
    // 导出
    import: (params: any) => {
      return request.download({url: "/yxt/member/import", params});
    },
    // 导出
    export: (params: any) => {
      return request.download({url: "/yxt/member/export", params});
    },
    // 学生课程数据导出
    courseDataExport: (params: any) => {
      return request.get({url: "/yxt/member/courseDataExport", params});
    },
    // 查询人员
    getMember: async (id: number) => {
      return await request.get({url: '/yxt/member/get?id=' + id})
    },
    // 创建人员
    createMember: (data: any) => {
      return request.post({url: '/yxt/member/create', data})
    },
    // 更新学校
    updateMember: (data: any) => {
      return request.post({url: '/yxt/member/update', data})
    },
    // 删除教师
    deleteTea: async (id: number) => {
      return await request.delete({url: '/yxt/member/tea/delete?id=' + id})
    },
    // 删除学生
    deleteStu: async (id: number) => {
      return await request.delete({url: '/yxt/member/stu/delete?id=' + id})
    },
    memberData: async (params: any) => {
      return await request.get({url: '/yxt/member/memberData', params})
    },
    majorMemberCount: async (params: any) => {
      return request.get({url: '/yxt/member/majorMemberCount', params})
    },
    listNoPage: async (params: any) => {
      return request.get({url: '/yxt/member/listNoPage', params})
    },
    getCourseData: async (params: any) => {
      return request.get({url: '/yxt/member/courseDataPage', params})
    },
    listByMemberType: async (memberType: number) => {
      return request.get({url: '/yxt/member/listByMemberType/' + memberType})
    }
  }
}
